import gtk

class DlgFileSelection:
    def __init__( self, title, initialFileName, selectMultiple = False):
        self.__fileName = initialFileName
        self.__dlg = gtk.FileSelection( title)
        self.__dlg.set_filename( self.__fileName)
        self.__dlg.set_select_multiple( selectMultiple)
        self.__dlg.ok_button.connect("clicked", self.__onOK)
        self.__dlg.cancel_button.connect("clicked", self.__onCancel)

    def getFileName( self):
        return self.__fileName

    def destroy( self):
        self.__dlg.destroy()

    def __onOK( self, button):
        self.__fileName = self.__dlg.get_filename()
        self.destroy()

    def __onCancel( self, button):
        self.__fileName = ""
        self.destroy()

    def show( self):
        self.__dlg.run()

